<?php
/**
 * Created by PhpStorm.
 * User: hp
 * Date: 2018/4/8
 * Time: 16:32
 */

require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor/autoload.php';

use Goutte\Client;

$client = new Client();

$js = file_get_contents('http://www.szmc.net/public/scripts/sites.js');

//$crawler = $client->request('GET', 'http://www.szmc.net/ver2/operating/search?scode=0101&xl=1');

/*$xianlu = $crawler->filter('ul.xianlu > li > a')->each(function ($node, $i) {
    $ret['link'] = $node->attr('href');
    $ret['name'] = $node->filter('span')->text();
    return $ret;
});


if ($xianlu){
    foreach($xianlu as &$v){
        parse_str(parse_url($v['link'])['query'],$output);
        $v = array_merge($v,$output);
    }
}*/

//$crawler = $client->click($crawler->filter('ul.xianlu > li > a')->link());

/*$xianlu = $crawler->filter('#siteList > a')->each(function ($node, $i) {
    $ret['link'] = $node->attr('href');
    $ret['name'] = $node->filter('li')->text();
    return $ret;
});

var_dump($xianlu);*/

?>

<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <?php echo '<script>'.$js.'</script>' ?>
    <script>
        console.log(sites);
        console.log(xls);
    </script>
</body>
</html>



